package com.grf.scala

/**
  * 模板类
  */
object CaseClass {
  def main(args: Array[String]): Unit = {
    val list  =List(1,2,3,"4")
    val partialFunction = new PartialFunction[Any,Int] {
      override def isDefinedAt(x: Any): Boolean = x.isInstanceOf[Int]
      override def apply(v1: Any): Int = {
        v1.asInstanceOf[Int] + 1
      }
    }
    val list2 = list.collect(partialFunction)
    println("list="+list2)
  }
}

abstract class Amount
case class Dollar(value: Double) extends Amount {
}
